package personal.persistance.model;

import java.util.Date;
import personal.persistance.AbstractJdbcModel;
import personal.persistance.mapper.MapperConstant;
import personal.util.DateTimeUtil;

/**
 *
 * @author LocNguyen
 */
public class Album extends AbstractJdbcModel<Integer> {
    private String name;
    private String author;
    private Date created;
    private Date lastModify;

    public Album() {
    }

    public Album(String name, String author, Date created, Date lastModify) {
        this.name = name;
        this.author = author;
        this.created = created;
        this.lastModify = lastModify;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getLastModify() {
        return lastModify;
    }

    public void setLastModify(Date lastModify) {
        this.lastModify = lastModify;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getTableName() {
        return MapperConstant.DB_NAME
            + ".album";
    }
    
    @Override
    public String[] getColumnNames() {
        return new String[] {
            "Name",
            "Author",
            "Created",
            "Last_Modified"
        };
    }

    @Override
    public Object[] getColumnValues() {
        return new Object[] {
            name,
            author,
            created,
            lastModify
        };
    }

    @Override
    public void setColumnValues(Object[] values) {
        name = values[0].toString();
        author = values[1].toString();
        created = DateTimeUtil.parse(values[2].toString());
        lastModify = DateTimeUtil.parse(values[2].toString());
    }

    @Override
    public boolean isIdAutoIncrement() {
        return true;
    }
    
}
